<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var mergeTriplets = function (triplets, target) {
      let [a, b, c] = target, k1, k2, k3 = 0
      for (const [x, y, z] of triplets) {
        if (x > a || y > b || z > c) continue
        if (x === a) k1 = 1
        if (y === b) k2 = 1
        if (z === c) k3 = 1
      }
      return k1 === 1 && k2 === 1 && k3 === 1
    };
    console.log(mergeTriplets(triplets = [[2, 5, 3], [1, 8, 4], [1, 7, 5]], target = [2, 7, 5])); 
  </script>
</body>

</html>